package com.woniuxy.demo.epai.service.impl;

import com.woniuxy.demo.epai.model.AuctionRecord;
import com.woniuxy.demo.epai.dao.AuctionRecordMapper;
import com.woniuxy.demo.epai.service.IAuctionRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.demo.epai.vo.ArecordVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 出价记录表 服务实现类
 * </p>
 *
 * @author epai
 * @since 2021-04-12
 */
@Service
@Slf4j
public class AuctionRecordServiceImpl implements IAuctionRecordService {

    @Autowired
    private AuctionRecordMapper auctionRecordMapper;

    @Override
    @Cacheable(value="arecordVo",key = "'arecordVo_'+#par_id")
    public List<ArecordVo> getRecord(int par_id) {
        List<ArecordVo> arecordVo = auctionRecordMapper.getArecordVoById(par_id);
        log.info("查询到{}",arecordVo);
        return arecordVo;
    }

    @Override
    public int addAuctionRecord(AuctionRecord auctionRecord) {
        auctionRecordMapper.addAuctionRecord(auctionRecord);
        Integer id = auctionRecord.getId();
        return id;
    }
}
